﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using AspNetCs.IDAL;
using AspNetCs.Common;
using AspNetCs.Model;
using System.Data;
using AspNetCs.Enumerations.VoteEnum;
using AspNetCs.Enumerations.Channel_Enum;
namespace AspNetCs.Bll
{
    public class UI_Page : System.Web.UI.Page
    {
        protected static IUserSaveType_Property GetLoginInfo = SaveType_Factory.Create();

        /// <summary>
        /// 网站首页用户登录
        /// </summary>
        /// <returns></returns>
        public static string UI_IndexLeftLogin()
        {


            StringBuilder stb = new StringBuilder();
            stb.AppendLine(Base_LoadingCreateDiv());

            stb.AppendLine("<div class=\"margin-top8 login \">");
            stb.AppendLine("<div class=\"loginTop\">");
            stb.AppendLine("        </div>");
            stb.AppendLine("       <div class=\"loginContent\">");
            if (GetLoginInfo.GetUserID <= 0)
            {
                stb.AppendLine("        <div class=\"Login_inputContent\">");
                stb.AppendLine("           <div class=\"loginInputText\">");
                stb.AppendLine("              <ul>");
                stb.AppendLine("                 <li class=\"litext\">用户名:</li>");
                stb.AppendLine("                 <li class=\"loginLi\">");
                stb.AppendLine("                    <input name=\"UserName\" id=\"UserName\" type=\"text\" class=\"liinput\" /></li>");
                stb.AppendLine("               <li class=\"litext\">密&nbsp;&nbsp;码:</li>");
                stb.AppendLine("           <li class=\"loginLi\">");
                stb.AppendLine("               <input name=\"Pwd\" id=\"Pwd\" type=\"password\" class=\"liinput\" /></li>");
                stb.AppendLine("            <li class=\"litext\">验证码:</li>");
                stb.AppendLine("           <li class=\"CheckCodeLi\">");
                stb.AppendLine("              <input name=\"CodeString\" id=\"CodeString\" type=\"text\" width='10'  /><img src=\"" + System_Lable.SystemGetCache.InstallDir + "CheckCode.aspx\" width='58' height='22'   id=\"UsercheckLoginCode\" alt=\"点击刷新验证码\"   align=\"absmiddle\"  onclick=\"javascript:document.getElementById('UsercheckLoginCode').src='" + System_Lable.SystemGetCache.InstallDir + "CheckCode.Aspx?id='+Math.random();return false; \" style=\"cursor:pointer;\"  /></li>");
                stb.AppendLine("     </ul>");
                stb.AppendLine("  </div>");
                stb.AppendLine(" <div class=\"ImgBtn\">");
                stb.AppendLine(" <input type=\"image\" src=\"" + System_Lable.SystemGetCache.InstallDir + "images/submit.gif\" id=\"loginSub\" /></div>");
                stb.AppendLine("</div>");
                stb.AppendLine(" <div class=\"Login_inputContent TextCenter\">");
                stb.AppendLine("     <a href=\"#\">新用户注册</a> | <a href=\"#\">忘记密码</a>");
                stb.AppendLine(" </div>");
            }
            else
            {
                Users_Model GetUserInfo = User_Bll.CreateNew.GetModel(GetLoginInfo.GetUserID);
                stb.AppendLine("<div class=\"Login_inputContent Black_A \" style=\"padding-left:15px;line-height:20px;\" >");
                stb.AppendLine(" 欢迎您，<font color=green><b>" + GetLoginInfo.GetUserName + "</b></font>！");
                stb.AppendLine("<br>在线时长： <strong class=\"blown\">" + StringHelper.FromatOnlineTime(GetUserInfo.OnlineTime.ToString()) + "</strong><br />");
                stb.AppendLine("可用积分： <strong class=\"blown\">" + GetUserInfo.Integral.ToString("#.##") + "</strong> 分<br />");
                stb.AppendLine("可用点数： <strong class=\"blown\">" + GetUserInfo.Point.ToString("#.##") + "</strong> 点");
                stb.AppendLine(" <br><b><a href='" + System_Lable.SystemGetCache.InstallDir + "Users/' target='_blank'>用户建管面板</a>：</b>");
                stb.AppendLine("<br>&nbsp;&nbsp;&nbsp;<a href='" + System_Lable.SystemGetCache.InstallDir + "Users/EditPwd.Aspx'>修改密码</a>");
                stb.AppendLine("&nbsp;&nbsp;<a href='" + System_Lable.SystemGetCache.InstallDir + "Users/MyInfo.Aspx'>个人信息</a><br>");
                stb.AppendLine("&nbsp;&nbsp;&nbsp;<a href=\"javascript:void(0)\" onclick=\"wy_addPhotoCat('SendMessage.aspx','发短消息',700,520);return false;\"  >发短消息</a>&nbsp;&nbsp;<a href='" + System_Lable.SystemGetCache.InstallDir + "Users/ReciveMessagesManage.aspx' target='_blank'>收件箱</a><font color=gray>0 新</font><br>&nbsp;&nbsp;&nbsp;<a href=''>在线充值</a>");
                stb.AppendLine("&nbsp;&nbsp;<a href='" + System_Lable.SystemGetCache.InstallDir + "Users/LoginOut.Aspx'>注销登录</a><br>");

                stb.AppendLine(" </div>");
            }


            stb.AppendLine("</div>");
            stb.AppendLine(" <div class=\"loginBottom\">");
            stb.AppendLine("    &nbsp;</div>");
            stb.AppendLine("</div>");



            return stb.ToString();
        }

        /// <summary>
        /// div加载中..... 对象名=imgloading
        /// </summary>
        /// <returns></returns>
        public static string Base_LoadingCreateDiv()
        {
            StringBuilder stb = new StringBuilder();
            stb.AppendLine("<style type=\"text/css\">");
            stb.AppendLine("<!-- ");
            stb.AppendLine(".imgloadingCss");
            stb.AppendLine("{");
            stb.AppendLine("position: absolute;");
            stb.AppendLine("left: 80px;");
            stb.AppendLine("top: 430px;");
            stb.AppendLine("width: 100px;");
            stb.AppendLine("height: 35px;");
            stb.AppendLine("text-align: center;");
            stb.AppendLine("padding-left: 10px;");
            stb.AppendLine("padding-top: 5px;");
            stb.AppendLine("z-index:99;");
            stb.AppendLine("display: none;");
            stb.AppendLine("background: #ffffff;");
            stb.AppendLine("border: 1px solid #709CD2;");
            stb.AppendLine("}");
            stb.AppendLine(" //-->");
            stb.AppendLine("</style>");
            stb.AppendLine("<div id=\"imgloading\" class=\"imgloadingCss\">");
            stb.AppendLine("<img src=\"" + System_Lable.SystemGetCache.InstallDir + "Images/loading1.gif\" align=\"absmiddle\" />&nbsp;&nbsp;加载中...</div>");
            return stb.ToString();
        }

        /*
   ==================================================
  '函数名：Announcestr
  '作  用：显示本站公告信息
  '==================================================
         
*/
        /// <summary>
        /// 显示本站公告信息
        /// </summary>
        /// <param name="AnnounceNum">显示数量</param>
        /// <returns></returns>
        public static string Announcestr(int AnnounceNum)
        {
            DataTable dt = Annouce_Bll.CreatNew.GetDataTable("");
            StringBuilder stb = new StringBuilder();
            if (dt.Rows.Count > 0)
            {
                stb.AppendLine("<MARQUEE scrollAmount=\"1\" scrollDelay=\"4\" width=\"100%\" height=\"150\" align=\"left\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\" direction=\"up\">");
                stb.AppendLine("<ul>");

                int i = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    Announce_Model Md = Annouce_Bll.CreatNew.getAnnouceById(StringHelper.isNumber_int(dr["id"]));
                    stb.AppendLine("<li> ");
                    stb.AppendLine("<a href=\"javascript:void(window.open('AnnounceShow.Aspx?id=" + Md.Id + "','AnnounceOpen','height=500,width=450,toolbar= no,location=no,top=130,left=200,scrollbars=yes,resizable=no,menubar=no'))\" >" + Md.Title + "</a>&nbsp;&nbsp;&nbsp;&nbsp;[" + Md.Addtime.ToString("yyyy-MM-dd") + "]");
                    stb.AppendLine("</li>");
                    i++;
                    if (i >= AnnounceNum) { break; }
                }
                stb.AppendLine("</ul>");
                stb.AppendLine("</MARQUEE>");


            }
            else
            {
                stb.AppendLine("暂无公告;");
            }





            return stb.ToString();
        }

        /// <summary>
        /// 在线追思
        /// </summary>
        /// <returns></returns>
        public static string onlineSq(int num, int pro, int city)
        {
            string sqlNum = "";
            if (num > 0)
            {
                sqlNum = " Top " + num;
            }

            DataTable dt = ExcuteSqlTextBLL.GetDataTable("Select " + sqlNum + " * from memorial where IsIndexTop=1 and isdel=0 " + DnsRequest.WhereString("province", "city", " and ", city, pro) + "  order by IndexTop_BeginTime desc ");


            StringBuilder Sqcontent = new StringBuilder();
            if (dt.Rows.Count > 0)
            {

                Sqcontent.AppendLine("<UL>");
                foreach (DataRow dr in dt.Rows)
                {
                    memorial_model Md = Memorial_Bll.CreateNew.GetModel(dr);
                    Sqcontent.AppendLine("<li>");
                    Sqcontent.AppendLine(" <table width='95%' border='0' align='center' cellspacing='0' cellpadding='0'>");
                    Sqcontent.AppendLine("  <tr><td  background='" + System_Lable.SystemGetCache.InstallDir + "images/photo_bg1.jpg'  height=98 width=76 align=center>");
                    Sqcontent.AppendLine("<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center'>");
                    Sqcontent.AppendLine("<tr>");
                    Sqcontent.AppendLine("    <td align=center><a href='" + DnsRequest.UrlDomainChange(Md.NumId, Channel_Type.memorial.ToString()) + "' target='_blank'><img src='" + Md.Picture + "'   height=90 width=68 border=0/></a></td>");
                    Sqcontent.AppendLine(" </tr>");
                    Sqcontent.AppendLine(" </table>");

                    Sqcontent.AppendLine(" </td>");

                    Sqcontent.AppendLine(" <td valign=top>");

                    Sqcontent.AppendLine(" <table width='100%' border='0' cellspacing='0' cellpadding='0' align='center'>");
                    Sqcontent.AppendLine("<tr>");
                    Sqcontent.AppendLine("<td align=center style='width:50px;'><strong>馆号:</strong></td><td align=left><strong style='color:#B30300'>" + Md.NumId + "</strong></td>");
                    Sqcontent.AppendLine("</tr>");
                    Sqcontent.AppendLine("<tr>");
                    Sqcontent.AppendLine("<td align=center>馆名:</td><td align=left><strong>" + Md.Names + "</strong></td></tr><tr><td align=center style='color:#B66E02' valign=top>悼词:</td><td align=left>");
                    Sqcontent.AppendLine(StringHelper.stringformat(StringHelper.RemoveHtml(Md.ReadMe), 48));
                    Sqcontent.AppendLine("</td>");
                    Sqcontent.AppendLine("</tr>");
                    Sqcontent.AppendLine("</table>");
                    Sqcontent.AppendLine("</td>");
                    Sqcontent.AppendLine("</tr>");
                    Sqcontent.AppendLine("<tr><td colspan=2>&nbsp;</td></tr>");

                    Sqcontent.AppendLine("</table>");

                    Sqcontent.AppendLine("</li>");
                }
                // Basepage Url_DomainChange(Eval("numid").ToString(),AspNetCs.Enumerations.Channel_Enum.Channel_Type.memorial.ToString())

                Sqcontent.AppendLine(" </ul>");
            }
            else
            {

                Sqcontent.AppendLine("暂无");
            }

            #region MyRegion
            //<li>


            //         <table width='100%' border='0' cellspacing='0' cellpadding='0'>
            //<tr><td  background='image/photo_bg1.jpg'  height=98 width=76 align=center>
            //<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center'>
            //<tr>
            //    <td align=center><a href='skins/?id=3521&istype=hall' target='_blank'><img src='images/nopic.jpg'   height=90 width=68 border=0/></a></td>
            //</tr>
            //</table>

            //</td>

            //<td valign=top>

            //<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center'>
            //<tr>
            //<td align=center style='width:50px;'><strong>馆号:</strong></td><td align=left><strong style='color:#B30300'>61666752</strong></td>
            //</tr>
            //<tr>
            //<td align=center>馆名:</td><td align=left><strong>123</strong></td></tr><tr><td align=center style='color:#B66E02' valign=top>悼词:</td><td align=left>
            //</td>
            //</tr>
            //</table>
            //</td>
            //</tr>
            //<tr><td colspan=2>&nbsp;</td></tr>

            //</table>                     

            //</li> 
            #endregion
            return Sqcontent.ToString();


        }

        /// <summary>
        /// 首页先祖宗祠推荐
        /// </summary>
        /// <returns></returns>
        public static string IndexClanOnTop(int num, int city, int pro)
        {

            StringBuilder stb = new StringBuilder();
            try
            {
                string sqlNum = "";
                if (num > 0)
                {
                    sqlNum = " Top " + num;
                }

                DataTable dt = ExcuteSqlTextBLL.GetDataTable("Select " + sqlNum + " * from AncestralHall where ischeck=1  and isdel=0 " + DnsRequest.WhereString("Province", "City", " and ", city, pro) + "  order by IsIntro desc,AcceeCount desc ");

                if (dt.Rows.Count > 0)
                {
                    stb.AppendLine("<ul>");

                    foreach (DataRow dr in dt.Rows)
                    {
                        AncestralHall_Model thisMd = AncestralHall_Bll.CreatNew.GetModel(dr);

                        stb.AppendLine(" <li>");
                        stb.AppendLine("<table width='77' border='0' cellspacing='0' cellpadding='0' align=center>");
                        stb.AppendLine("<tr><td align=center style='background-image:url(" + System_Lable.SystemGetCache.InstallDir + "images/zc_bg.gif);' height='94' widht='77' ><table width='80%' border='0' cellspacing='0' cellpadding='0' align=center><tr><td  align=center><a href='" + DnsRequest.UrlDomainChange(thisMd.AncestralHallId, Channel_Type.clan.ToString()) + "' target='_blank'><strong style='font-size:13px;height:50px;cursor:hand;'>" + thisMd.PreName + "氏宗祠</strong></a></td></tr><tr><td align=center><div  style='PADDING-LEFT: 0px;no-repeat 0px -12px; FILTER: glow(color:#D0D1C1,strength=3); LEFT: 10px;  COLOR: #DC000C; WHITE-SPACE: nowrap; line-height:18px; height:5px;'>" + thisMd.AncestralHallId + "</div></td></tr></table></a></td></tr><tr><td align=center>&nbsp;&nbsp;</td></tr></table> ");
                        stb.AppendLine("</li>");
                    }

                    stb.AppendLine("</ul>");
                }
                else
                {
                    stb.AppendLine("<center><br><br><br>对不起，暂时没有推荐的先祖宗祠<br><br><br></center>");
                }
            }
            catch
            {

            }


            return stb.ToString();
        }

        /// <summary>
        /// 首页最新建馆
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static string IndexCreateNewsMemorial(int num, int city, int pro)
        {

            StringBuilder stb = new StringBuilder();
            try
            {

                string sqlNum = "";
                if (num > 0)
                {
                    sqlNum = " Top " + num;
                }

                DataTable dt = ExcuteSqlTextBLL.GetDataTable("Select " + sqlNum + " * from memorial where ischeck=1 and isdel=0 and IsWelfare=0 " + DnsRequest.WhereString("Province", "City", " and ", city, pro) + "  order by Addtime desc ");


                if (dt.Rows.Count > 0)
                {

                    stb.AppendLine("<ul>");
                    stb.AppendLine("<li>");
                    for (int i = 0; i <= dt.Rows.Count; i++)
                    {

                        stb.AppendLine("<table width='98%' border='0' cellspacing='0' cellpadding='0' align=center>");
                        stb.AppendLine("<tr>");
                        for (int j = i; j <= dt.Rows.Count; j++)
                        {
                            stb.AppendLine("<td width=\"50%\">");

                            memorial_model MemorialMd = Memorial_Bll.CreateNew.GetModel(dt.Rows[j]);
                            #region MyRegion

                            stb.AppendLine("<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                            stb.AppendLine("<tr>");
                            stb.AppendLine("<td width=\"76\" height=\"98\" valign=\"top\" background=\"" + System_Lable.SystemGetCache.InstallDir + "images/photo_bg1.jpg\" ><table width=\"100%\" height=\"96\" border=\"0\" cellpadding=\"0\" cellspacing=\"4\">");
                            stb.AppendLine("<tr>");
                            stb.AppendLine("<td valign=\"top\"><a href=\"" + DnsRequest.UrlDomainChange(MemorialMd.NumId, Channel_Type.memorial.ToString()) + "\" target=\"_blank\"><img src=\"" + System_Lable.SystemGetCache.InstallDir + "" + MemorialMd.Picture + "\"  width=\"70\" height=\"90\" border=\"0\"></a></td>");
                            stb.AppendLine("</tr>");
                            stb.AppendLine("</table></td>");
                            stb.AppendLine("<td valign=\"top\" align=\"left\" >");
                            stb.AppendLine("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                            stb.AppendLine("<tr>");
                            stb.AppendLine("<td align=\"right\"><span class=\"red\">馆&nbsp; &nbsp; 号:</span></td>");
                            stb.AppendLine("<td align=\"left\"><strong>" + MemorialMd.NumId + "</strong></td>");
                            stb.AppendLine("</tr>");
                            stb.AppendLine("<tr>");
                            stb.AppendLine("<td align=\"right\"><span class=\"red\">馆&nbsp;&nbsp;&nbsp; 名:</span></td>");
                            stb.AppendLine("<td align=\"left\"><strong>" + StringHelper.stringformat(StringHelper.RemoveHtml(MemorialMd.Names), 10) + "</strong></td>");
                            stb.AppendLine("</tr>");
                            stb.AppendLine("<tr>");
                            stb.AppendLine("<td colspan=\"2\" align=\"left\"><hr noshade=\"noshade\" width=\"100%\" size=\"1\"></td>");
                            stb.AppendLine("</tr>   <tr>");
                            stb.AppendLine("<td  align=\"right\"><span class=\"red\">创 建 人:</span></td>");
                            stb.AppendLine("<td align=\"left\">" + StringHelper.stringformat(StringHelper.RemoveHtml(User_Bll.CreateNew.GetModel(MemorialMd.CreateId).UserName), 10) + "</td>");
                            stb.AppendLine("</tr>");
                            stb.AppendLine("<tr>");
                            stb.AppendLine("<td width=\"40%\" align=\"right\"><span class=\"red\">创建时间:</span></td>");
                            stb.AppendLine("<td width=\"60%\"  align=\"left\">" + MemorialMd.Addtime.ToString("yyyy-MM-dd") + "</td>");
                            stb.AppendLine("</tr>");
                            stb.AppendLine("</table></td>");
                            stb.AppendLine("</tr>");
                            stb.AppendLine("<tr>");
                            stb.AppendLine("<td>&nbsp;</td>");
                            stb.AppendLine("<td valign=\"top\">&nbsp;</td>");
                            stb.AppendLine("</tr>");
                            stb.AppendLine("</table>");


                            #endregion
                            stb.AppendLine("</td>");
                            if ((j + 1) % 2 == 0 || ((j + 1) >= dt.Rows.Count))
                            {
                                stb.AppendLine("</tr>");
                            }

                            i = j;
                            if (((j + 1) % 2 == 0) || ((j + 1) >= dt.Rows.Count))
                            {
                                break;
                            }

                        }
                        stb.AppendLine("</table>");

                        if ((i + 1) >= dt.Rows.Count)
                        {
                            stb.AppendLine("</li>");
                            break;
                        }

                        if ((i + 1) % 4 == 0)
                        {
                            stb.AppendLine("</li><li>");
                        }

                    }
                    stb.AppendLine(" </ul>");
                }
                else
                {
                    stb.AppendLine("<center><br><br>暂无最新建馆<br><br></center>");
                }


            }
            catch
            {
                return "<center>暂无最新建馆</center>";
            }




            return stb.ToString();
        }

        /// <summary>
        /// 首页公益记念馆
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static string PublicCreateNewsMemorial(int num, int city, int pro)
        {
            StringBuilder stb = new StringBuilder();
            try
            {
                string sqlNum = "";
                if (num > 0)
                {
                    sqlNum = " Top " + num;
                }

                DataTable dt = ExcuteSqlTextBLL.GetDataTable("Select " + sqlNum + " * from memorial where ischeck=1 and isdel=0 and IsWelfare=1 " + DnsRequest.WhereString("Province", "City", " and ", city, pro) + "  order by Addtime desc ");

                stb.AppendLine("<ul>");
                if (dt.Rows.Count > 0)
                {

                    foreach (DataRow dr in dt.Rows)
                    {
                        memorial_model ThisMd = Memorial_Bll.CreateNew.GetModel(dr);
                        stb.AppendLine("<li>");
                        stb.AppendLine("<table width='76' border='0' align='center' cellpadding='0' cellspacing='0' style='font-size:12px'>");

                        stb.AppendLine("<tr  height='98'><td align='center'  background='" + System_Lable.SystemGetCache.InstallDir + "images/photo_bg2.jpg'>");
                        stb.AppendLine("<a href='" + DnsRequest.UrlDomainChange(ThisMd.NumId, Channel_Type.memorial.ToString()) + "' target='_blank'><img src='" + System_Lable.SystemGetCache.InstallDir + ThisMd.Picture + "'  width='70' height='90' border='0'></a>");
                        stb.AppendLine("</td></tr>");
                        stb.AppendLine("<tr><td align='center' height='25'>" + StringHelper.stringformat(StringHelper.RemoveHtml(ThisMd.Names), 12) + "</td></tr>");
                        stb.AppendLine(" </table>");
                        stb.AppendLine("</li>");
                    }

                }
                else
                {
                    stb.AppendLine("<li style='width:400px;'>");
                    stb.AppendLine("暂时没有公益纪念馆");
                    stb.AppendLine("</li>");
                }

                stb.AppendLine("</ul>");


            }
            catch
            {
                return "";
            }

            return stb.ToString();
        }
        /// <summary>
        /// 网站调查
        /// </summary>
        /// <param name="num"></param>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static string IndexVoteBind(int num, DataTable dt)
        {
            StringBuilder stb = new StringBuilder();


            try
            {
                if (dt.Rows.Count > 0)
                {
                    stb.AppendLine("<ul>");
                    Vote_Model ThisMd = Vote_Bll.CreateNew.GetModel(dt.Rows[0]);
                    stb.AppendLine("<li  class=\"VoteClassText\" ><input type='hidden' name='Voteid' id=\"Voteid\" value='" + ThisMd.Id + "' >");
                    stb.AppendLine("&nbsp;&nbsp;" + ThisMd.Title);
                    stb.AppendLine("</li>");

                    string TypeString = "";

                    #region 1
                    if (ThisMd.Select1 != "")
                    {
                        stb.AppendLine("<li  class=\"VoteClassText\" >");
                        if (ThisMd.VoteType == (int)VoteTypeEnum.checkAll)
                        {
                            TypeString = "<input name=\"VoteSelect\"  id=\"VoteSelect\" type='checkbox' value='1'>";
                        }
                        else
                        {

                            TypeString = "<input  name=\"VoteSelect\"  id=\"VoteSelect\"  type='Radio' value='1'>";
                        }
                        stb.AppendLine(TypeString + ThisMd.Select1);
                        stb.AppendLine("</li>");
                    }

                    #endregion

                    #region 2
                    if (ThisMd.Select2 != "")
                    {
                        stb.AppendLine("<li  class=\"VoteClassText\" >");
                        if (ThisMd.VoteType == (int)VoteTypeEnum.checkAll)
                        {
                            TypeString = "<input name=\"VoteSelect\"  id=\"VoteSelect\" type='checkbox' value='2'>";
                        }
                        else
                        {

                            TypeString = "<input  name=\"VoteSelect\"  id=\"VoteSelect\"  type='Radio' value='2'>";
                        }
                        stb.AppendLine(TypeString + ThisMd.Select2);
                        stb.AppendLine("</li>");
                    }

                    #endregion

                    #region 3
                    if (ThisMd.Select3 != "")
                    {
                        stb.AppendLine("<li  class=\"VoteClassText\" >");
                        if (ThisMd.VoteType == (int)VoteTypeEnum.checkAll)
                        {
                            TypeString = "<input name=\"VoteSelect\"  id=\"VoteSelect\" type='checkbox' value='3'>";
                        }
                        else
                        {

                            TypeString = "<input  name=\"VoteSelect\"  id=\"VoteSelect\"  type='Radio' value='3'>";
                        }
                        stb.AppendLine(TypeString + ThisMd.Select3);
                        stb.AppendLine("</li>");
                    }

                    #endregion

                    #region 4
                    if (ThisMd.Select4 != "")
                    {
                        stb.AppendLine("<li  class=\"VoteClassText\" >");
                        if (ThisMd.VoteType == (int)VoteTypeEnum.checkAll)
                        {
                            TypeString = "<input name=\"VoteSelect\"  id=\"VoteSelect\" type='checkbox' value='4'>";
                        }
                        else
                        {

                            TypeString = "<input  name=\"VoteSelect\"  id=\"VoteSelect\"  type='Radio' value='4'>";
                        }
                        stb.AppendLine(TypeString + ThisMd.Select4);
                        stb.AppendLine("</li>");
                    }

                    #endregion

                    #region 5
                    if (ThisMd.Select5 != "")
                    {
                        stb.AppendLine("<li  class=\"VoteClassText\" >");
                        if (ThisMd.VoteType == (int)VoteTypeEnum.checkAll)
                        {
                            TypeString = "<input name=\"VoteSelect\"  id=\"VoteSelect\" type='checkbox' value='5'>";
                        }
                        else
                        {

                            TypeString = "<input  name=\"VoteSelect\"  id=\"VoteSelect\"  type='Radio' value='5'>";
                        }
                        stb.AppendLine(TypeString + ThisMd.Select5);
                        stb.AppendLine("</li>");
                    }

                    #endregion

                    #region 6
                    if (ThisMd.Select6 != "")
                    {
                        stb.AppendLine("<li  class=\"VoteClassText\" >");
                        if (ThisMd.VoteType == (int)VoteTypeEnum.checkAll)
                        {
                            TypeString = "<input name=\"VoteSelect\"  id=\"VoteSelect\" type='checkbox' value='6'>";
                        }
                        else
                        {

                            TypeString = "<input  name=\"VoteSelect\"  id=\"VoteSelect\"  type='Radio' value='6'>";
                        }
                        stb.AppendLine(TypeString + ThisMd.Select6);
                        stb.AppendLine("</li>");
                    }

                    #endregion

                    #region 7
                    if (ThisMd.Select7 != "")
                    {
                        stb.AppendLine("<li  class=\"VoteClassText\" >");
                        if (ThisMd.VoteType == (int)VoteTypeEnum.checkAll)
                        {
                            TypeString = "<input name=\"VoteSelect\"  id=\"VoteSelect\" type='checkbox' value='7'>";
                        }
                        else
                        {

                            TypeString = "<input  name=\"VoteSelect\"  id=\"VoteSelect\"  type='Radio' value='7'>";
                        }
                        stb.AppendLine(TypeString + ThisMd.Select7);
                        stb.AppendLine("</li>");
                    }

                    #endregion

                    #region 8
                    if (ThisMd.Select8 != "")
                    {
                        stb.AppendLine("<li  class=\"VoteClassText\" >");
                        if (ThisMd.VoteType == (int)VoteTypeEnum.checkAll)
                        {
                            TypeString = "<input name=\"VoteSelect\"  id=\"VoteSelect\" type='checkbox' value='8'>";
                        }
                        else
                        {

                            TypeString = "<input  name=\"VoteSelect\"  id=\"VoteSelect\"  type='Radio' value='8'>";
                        }

                        stb.AppendLine(TypeString + ThisMd.Select8);
                        stb.AppendLine("</li>");
                    }

                    #endregion

                    stb.AppendLine("<li>");
                    stb.AppendLine(" <input type=\"image\" src=\"Images/bt_voteSubmit.gif\" name=\"VoteSub\" id=\"VoteSub\" width=\"60\" height=\"30\" />");
                    stb.AppendLine("<input type=\"image\" src=\"Images/bt_voteView.gif\"  name=\"VoteSee\"  id=\"VoteSee\"  width=\"60\" height=\"30\" />");
                    stb.AppendLine("</li>");
                    stb.AppendLine("</ul>");
                }
                else
                {
                    stb.AppendLine("<center>暂时没有网站调查</center>");
                }
            }
            catch
            {
                return "";
            }
            return stb.ToString();
        }
        /// <summary>
        /// 网站调查
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static string IndexVoteBind(int num)
        {
            string sqlNum = "";
            if (num > 0)
            {
                sqlNum = " Top " + num;
            }
            DataTable dt = ExcuteSqlTextBLL.GetDataTable("Select " + sqlNum + " * from vote   order by isnew desc, Addtime desc ");
            if (dt != null)
            {
                return IndexVoteBind(num, dt);
            }
            else
            {
                return "";
            }
        }

        /// <summary>
        /// 首页孝为天排行
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static string IndexMemorialList(int num, int city, int pro)
        {
            StringBuilder stb = new StringBuilder();
            string sqlNum = "";
            if (num > 0)
            {
                sqlNum = " Top " + num;
            }
            DataTable dt = ExcuteSqlTextBLL.GetDataTable("Select " + sqlNum + " * from memorial where Ischeck=1 and isdel=0  " + DnsRequest.WhereString("Province", "City", " and ", city, pro) + " order by hot desc, Addtime desc ");

            try
            {

                if (dt.Rows.Count > 0)
                {
                    stb.AppendLine("<ul>");
                    stb.AppendLine("<li class=\"xwx_Title\">馆号</li>");
                    stb.AppendLine("<li class=\"xwx_Title1\">馆名</li>");
                    stb.AppendLine("<li class=\"xwx_Title2\">访问量</li>");
                    stb.AppendLine("<li class=\"xwx_Title3\">建馆日期</li>");
                    stb.AppendLine("</ul>");
                    stb.AppendLine("<ul>");
                    foreach (DataRow dr in dt.Rows)
                    {
                        memorial_model ThisMd = Memorial_Bll.CreateNew.GetModel(dr);
                        stb.AppendLine("<li class=\"xwx_ContentList\">" + ThisMd.NumId + "</li>");
                        stb.AppendLine("<li class=\"xwx_ContentList1\"><a href='" + DnsRequest.UrlDomainChange(ThisMd.NumId, Channel_Type.memorial.ToString()) + "' target='_blank'>" + StringHelper.stringformat(StringHelper.RemoveHtml(ThisMd.Names), 16) + "</a></li>");
                        stb.AppendLine("<li class=\"xwx_ContentList2\">" + ThisMd.Hot + "</li>");
                        stb.AppendLine("<li class=\"xwx_ContentList3\">" + ThisMd.Addtime.ToShortDateString() + "</li>");
                    }
                    stb.AppendLine("</ul>");




                }
                else
                {

                    stb.AppendLine("<center><br><br>暂无信息<br><br></center>");
                }
            }
            catch (Exception Ex)
            {
                return Ex.Message;
            }
            return stb.ToString();






        }


        /// <summary>
        /// 首页公墓园区排行
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static string IndexGravestoneList(int num, int city, int pro)
        {
            StringBuilder stb = new StringBuilder();
            string sqlNum = "";
            if (num > 0)
            {
                sqlNum = " Top " + num;
            }
            DataTable dt = ExcuteSqlTextBLL.GetDataTable("Select " + sqlNum + " * from NetMu where Ischeck=1 and isdel=0 " + DnsRequest.WhereString("Province", "City", " and ", city, pro) + "  order by hot desc, CreateDate desc ");

            try
            {

                if (dt.Rows.Count > 0)
                {
                    stb.AppendLine("<ul>");
                    stb.AppendLine("<li class=\"xwx_Title\">馆号</li>");
                    stb.AppendLine("<li class=\"xwx_Title1\">馆名</li>");
                    stb.AppendLine("<li class=\"xwx_Title2\">访问量</li>");
                    stb.AppendLine("<li class=\"xwx_Title3\">建馆日期</li>");
                    stb.AppendLine("</ul>");
                    stb.AppendLine("<ul>");
                    foreach (DataRow dr in dt.Rows)
                    {
                        NetMu_Model ThisMd = NetMu_Bll.CreatNew.getNetMuDetailInfo(StringHelper.isNumber_int(dr["id"]));
                        stb.AppendLine("<li class=\"xwx_ContentList\">" + ThisMd.MuId + "</li>");
                        stb.AppendLine("<li class=\"xwx_ContentList1\"><a href='" + DnsRequest.UrlDomainChange(ThisMd.MuId, Channel_Type.gravestone.ToString()) + "' target='_blank'>" + StringHelper.stringformat(StringHelper.RemoveHtml(ThisMd.MuName), 16) + "</a></li>");
                        stb.AppendLine("<li class=\"xwx_ContentList2\">" + ThisMd.Hot + "</li>");
                        stb.AppendLine("<li class=\"xwx_ContentList3\">" + ThisMd.CreateDate.ToShortDateString() + "</li>");
                    }
                    stb.AppendLine("</ul>");




                }
                else
                {

                    stb.AppendLine("<center><br><br>暂无信息<br><br></center>");
                }
            }
            catch (Exception Ex)
            {
                return Ex.Message;
            }
            return stb.ToString();






        }



        /// <summary>
        /// 首页陵园排行
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static string IndexCemeteryList(int num, int city, int pro)
        {
            StringBuilder stb = new StringBuilder();
            string sqlNum = "";
            if (num > 0)
            {
                sqlNum = " Top " + num;
            }
            DataTable dt = ExcuteSqlTextBLL.GetDataTable("Select " + sqlNum + " * from Cemetery where Ischeck=1 and isdel=0 " + DnsRequest.WhereString("Province", "City", " and ", city, pro) + "    order by hot desc, Addtime desc ");

            try
            {

                if (dt.Rows.Count > 0)
                {
                    stb.AppendLine("<ul>");
                    stb.AppendLine("<li class=\"xwx_Title\">馆号</li>");
                    stb.AppendLine("<li class=\"xwx_Title1\">馆名</li>");
                    stb.AppendLine("<li class=\"xwx_Title2\">访问量</li>");
                    stb.AppendLine("<li class=\"xwx_Title3\">建馆日期</li>");
                    stb.AppendLine("</ul>");
                    stb.AppendLine("<ul>");
                    foreach (DataRow dr in dt.Rows)
                    {
                        Cemetery_Model ThisMd = Cemetery_Bll.CreateNew.GetModel(dr);
                        stb.AppendLine("<li class=\"xwx_ContentList\">" + ThisMd.Numid + "</li>");
                        stb.AppendLine("<li class=\"xwx_ContentList1\"><a href='" + DnsRequest.UrlDomainChange(ThisMd.Numid, Channel_Type.cemetery.ToString()) + "' target='_blank'>" + StringHelper.stringformat(StringHelper.RemoveHtml(ThisMd.Names), 16) + "</a></li>");
                        stb.AppendLine("<li class=\"xwx_ContentList2\">" + ThisMd.Hot + "</li>");
                        stb.AppendLine("<li class=\"xwx_ContentList3\">" + ThisMd.Addtime.ToShortDateString() + "</li>");
                    }
                    stb.AppendLine("</ul>");




                }
                else
                {

                    stb.AppendLine("<center><br><br>暂无信息<br><br></center>");
                }
            }
            catch (Exception Ex)
            {
                return Ex.Message;
            }
            return stb.ToString();






        }



        /// <summary>
        /// 首页宗祠排行
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static string IndexClanList(int num, int city, int pro)
        {
            StringBuilder stb = new StringBuilder();
            string sqlNum = "";
            if (num > 0)
            {
                sqlNum = " Top " + num;
            }
            DataTable dt = ExcuteSqlTextBLL.GetDataTable("Select " + sqlNum + " * from AncestralHall where Ischeck=1 and isdel=0  " + DnsRequest.WhereString("Province", "City", " and ", city, pro) + "  order by AcceeCount desc, CreateTime desc ");

            try
            {

                if (dt.Rows.Count > 0)
                {
                    stb.AppendLine("<ul>");
                    stb.AppendLine("<li class=\"xwx_Title\">馆号</li>");
                    stb.AppendLine("<li class=\"xwx_Title1\">馆名</li>");
                    stb.AppendLine("<li class=\"xwx_Title2\">访问量</li>");
                    stb.AppendLine("<li class=\"xwx_Title3\">建馆日期</li>");
                    stb.AppendLine("</ul>");
                    stb.AppendLine("<ul>");
                    foreach (DataRow dr in dt.Rows)
                    {
                        AncestralHall_Model ThisMd = AncestralHall_Bll.CreatNew.GetModel(dr);
                        stb.AppendLine("<li class=\"xwx_ContentList\">" + ThisMd.AncestralHallId + "</li>");
                        stb.AppendLine("<li class=\"xwx_ContentList1\"><a href='" + DnsRequest.UrlDomainChange(ThisMd.AncestralHallId, Channel_Type.clan.ToString()) + "' target='_blank'>" + StringHelper.stringformat(StringHelper.RemoveHtml(ThisMd.Name), 16) + "</a></li>");
                        stb.AppendLine("<li class=\"xwx_ContentList2\">" + ThisMd.AcceeCount + "</li>");
                        stb.AppendLine("<li class=\"xwx_ContentList3\">" + ThisMd.CreateTime.ToShortDateString() + "</li>");
                    }
                    stb.AppendLine("</ul>");




                }
                else
                {

                    stb.AppendLine("<center><br><br>暂无信息<br><br></center>");

                }
            }
            catch (Exception Ex)
            {
                return Ex.Message;
            }
            return stb.ToString();






        }

        public static string IndexTabFlash()
        {
            StringBuilder stb = new StringBuilder();
            DataTable dt = ExcuteSqlTextBLL.GetDataTable("Select * from IndexTabAd order by addtime desc");

            string picstr = "";
            string linkstr = "";
            int i = 0;
            foreach (DataRow dr in dt.Rows)
            {
                picstr += dr["pictext"].ToString();
                linkstr += dr["picTitle"].ToString();
                i++;
                if (i < dt.Rows.Count)
                {
                    picstr += "|";
                    linkstr += "|";
                }
            }

            stb.Append("<script src='Focus.Aspx?picsValue=" + HttpUtility.UrlEncode(picstr) + "&linksValue=" + HttpUtility.UrlEncode(linkstr) + "'></script>");
            //<script src='focus.asp?picsValue=/UploadAdpic/20085241222251857.jpg|/UploadAdpic/20085241231325718.jpg|/UploadAdpic/2008524124946636.jpg|/UploadAdpic/20085241273419291.jpg|/UploadAdpic/2008524128127072.jpg|/UploadAdpic/20086152584569357.jpg&linksValue=http://www.999qm.com/skins/hall/ODLuxuryFourTeen/?id=2127|http://www.999qm.com/skins/hall/ODLuxuryFourTeen/?id=2127|http://www.999qm.com/skins/hall/ODLuxuryFourTeen/?id=2127|http://www.999qm.com/skins/hall/ODLuxuryFourTeen/?id=2127|http://www.999qm.com/skins/hall/ODLuxuryFourTeen/?id=2127|http://www.999qm.com'></script>


            return stb.ToString();
        }



    }
}
